package player;

import java.util.Random;

import gameBasicElements.PlayerColor;
import gameBasicElements.Position;
import gameBasicElements.ScoreBoard;
import gameEngine.GameInfo;

/**
 * @author Tomasz Wiatrowski
 *
 */
public class AIPlayer implements Player {

	private GameInfo info;
	private int size;
	private int toPass;
	
	@Override
	public void endGame(ScoreBoard finalScores)
			throws PlayerNotRespondingException {
	}

	@Override
	public Position getMove() throws PlayerNotRespondingException {
		toPass = (toPass+1)%100;
		if(toPass == 0)
			return null;
		Random rand = new Random();
		int x = rand.nextInt(size);
		int y = rand.nextInt(size);
		return new Position(x, y);
	}

	@Override
	public void nextTurn() throws PlayerNotRespondingException {
		
	}

	@Override
	public void startGame(GameInfo gameInfo, PlayerColor thisPlayerColor)
			throws PlayerNotRespondingException, IllegalStateException {
		this.info = gameInfo;
		this.size = info.getCurrentBoard().getSize();
		this.toPass = 1;
	}

}
